# This is a sample Python script.
from concurrency.threadPool import ThreadPool
from mqtt.mqttKesonConnect import mqtt_keson_connect
from readWriteExcel.excelFile import operate


# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.


def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    pool = ThreadPool(num_threads=3)
    pool.start()
    pool.add_task(mqtt_keson_connect)
    pool.add_task(operate)
    try:
        # 等待所有任务完成
        pool.wait_completion()
    except KeyboardInterrupt:
        print("\n检测到用户中断 (Ctrl+C)，正在关闭线程池...")
        pool.stop_all()
    operate()

# See PyCharm help at https://www.jetbrains.com/help/pycharm/
